const Immutable=require("immutable")
const {fromJS,Map,List}=Immutable
const obj={
    name:"lx",
    age:23,
    address:{
        city:"武汉",
        region:"江夏"
    },
    hobbies:[
        {name:"javascript",desc:"是一种前端编程语言"},
        {name:"王者荣耀",desc:"一种流行手机游戏"}
    ]
}
const imgObj=fromJS(obj)

// const imgObj111=imgObj.set("name","lxx")修改第一级熟悉值
// const imgObj111=imgObj.setIn(["address","region"],"洪山")修改多级熟悉值
// const imgObj111=imgObj.setIn(["hobbies",1,"name"],"和平精英")
// console.log(imgObj111)

// console.log(imgObj.get('name'))
// console.log(imgObj.getIn(["address","city"]))
// console.log(imgObj.getIn(["hobbies",0,"name"]))

// const imgObj222=imgObj.update("hobbies",(hobbies)=>{
//    return hobbies.push(Map({name:"QQ飞车",desc:"一款好玩的游戏"}))
// })
// const imgObj222=imgObj.update("hobbies",(hobbies)=>{
//     return hobbies.unshift(Map({name:"HTML和CSS",desc:"前端基础"}),Map({name:"JQ",desc:"一款轻量级框架"}))
// })
console.log(imgObj222)
